import * as service from "@/service";
import { IBrand, IBrand2, IBrandBody, IBrandSkip } from "./interface";
const brand: IBrand = {
  namespaced: true,
  state: {
    brands: [],
  },
  actions: {
    async getBrand({ commit }) {
      const res = await service.fist_brand();
      const action = {
        type: "GET_BRAND",
        res: res,
      };
      commit(action);
    },
  },
  mutations: {
    GET_BRAND(state, { res }) {
      state.brands = res;
    },
  },
};
const brand_2: IBrand2 = {
  namespaced: true,
  state: {
    brands: [],
  },
  actions: {
    async getBrand({ commit }) {
      const res = await service.fistBrand();
      const action = {
        type: "GET_BRAND",
        res: res,
      };
      commit(action);
    },
  },
  mutations: {
    GET_BRAND(state, { res }) {
      state.brands = res;
    },
  },
};
const brand_body: IBrandBody = {
  namespaced: true,
  state: {
    brands: [],
  },
  actions: {
    async getBrand({ commit }) {
      const res = await service.fist_brand_body();
      const action = {
        type: "GET_BRAND",
        res: res,
      };
      commit(action);
    },
  },
  mutations: {
    GET_BRAND(state, { res }) {
      state.brands = res;
    },
  },
};

const brand_skip: IBrandSkip = {
  namespaced: true,
  state: {
    brands: [],
  },
  actions: {
    async getBrand({ commit }, { params }) {
      const res = await service.brand_body(params.val);
      const action = {
        type: "GET_BRAND",
        res: res,
      };
      commit(action);
    },
  },
  mutations: {
    GET_BRAND(state, { res }) {
      state.brands = res;
    },
  },
};
export { brand, brand_2, brand_body, brand_skip };
